#ifndef __COMMON_DIRECTSHOWWRAPPER_VIDEOSTREAM_H__
#define __COMMON_DIRECTSHOWWRAPPER_VIDEOSTREAM_H__

#include "DirectShowWrapper.h"

BEGIN_DIRECTSHOWWRAPPER_NAMESPACE

class CaptureDevice;

/// <summary>
///
/// </summary>
class CaptureVideoStream : public ISampleGrabberCB
{
public:
    /// <summary>
	///
	/// </summary>
    CaptureVideoStream(CaptureDevice *pCaptureDevice);

    /// <summary>
	///
	/// </summary>
    ~CaptureVideoStream();

	/// <summary>
	///
	/// </summary>
    void Start();

private:
	/// <summary>
	///
	/// </summary>
	STDMETHODIMP_(ULONG) AddRef();

	/// <summary>
	///
	/// </summary>
	STDMETHODIMP BufferCB(double dblSampleTime, BYTE * pBuffer, long lBufferSize);

    /// <summary>
	///
	/// </summary>
    bool Initialize();

	/// <summary>
	///
	/// </summary>
	STDMETHODIMP QueryInterface(REFIID riid, void ** ppv);

	/// <summary>
	///
	/// </summary>
    STDMETHODIMP_(ULONG) Release();

	/// <summary>
	///
	/// </summary>
	STDMETHODIMP SampleCB(double SampleTime, IMediaSample * pSample);

private:
    /// <summary>
	///
	/// </summary>
    CaptureDevice *m_pCaptureDevice;

    /// <summary>
	///
	/// </summary>
	IGraphBuilderPtr m_pGraphBuilderPtr;

	/// <summary>
	///
	/// </summary>
	ICaptureGraphBuilder2Ptr m_pCaptureGraphBuilder2Ptr;

	/// <summary>
	///
	/// </summary>
	IMediaControlPtr m_pMediaCtrl;

	/// <summary>
	///
	/// </summary>
	IMediaEventPtr m_pMediaEvent;

	/// <summary>
	///
	/// </summary>
	ISampleGrabberPtr m_pSampleGrabber;

    /// <summary>
	///
	/// </summary>
    IVideoWindowPtr m_pVideoWindow;

    ///// <summary>
	/////
	///// </summary>
	//IBaseFilterPtr m_pSampleGrabber;	

	/// <summary>
	///
	/// </summary>
	LONG m_Ref;
};

END_DIRECTSHOWWRAPPER_NAMESPACE

#endif